from typing import List


class Solution:
    def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
        queue = []
        people = sorted(people, key=lambda x: (-x[0], x[1]))
        for p in people:
            h, k = p
            queue.insert(k, p)
        return queue


solution = Solution()
res = solution.reconstructQueue([[7,0],[4,4],[7,1],[5,0],[6,1],[5,2]])
print(res)

